var Q = require('q'),
    operationController = require('../../../CBO/server/controllers/Operation.server.controller'),
    barcodeMasterController = require('../../../Barcode/server/controllers/BarcodeMaster.server.controller'),
    bizRecordController = require('../../../Barcode/server/controllers/BizRecord.server.controller'),
    qcRecordController = require('../../../QC/server/controllers/QCRecord.server.controller'),
    workController = require('../../../CBO/server/controllers/Work.server.controller'),
    enumController = require('../../../QC/server/controllers/Enum.server.controller'),
    extendEnumController = require('../../../SystemManage/server/controllers/ExtendEnum.server.controller');

//重平仪写入流水和质检记录
exports.submitBizRecordAndQCRecord = function (req, res) {
		//服务接口格式：芯片id、设备id、采集时间、质检结果、质检记录集合（质检指标、指标值）。
    var parameter = req.body.Parameter,
	    barcodeId = parameter.barcodeId,
	    deviceId = parameter.deviceId,
	    collectionTime = parameter.collectionTime,
	    qcStatus = parameter.qcStatus,//合格或不合格
        qcRecord = parameter.qcRecord;
    barcodeMasterController.findBarcodeMasterAllData(Barcode, function (err, result) {
        // console.log("getBarcodeData-------------"+result);
        if (err) {
            res.json({
                Data: null,
                Error: err
            });
        } else {
            if (result == null) {
                var newErr = new Error();
                newErr.leval = 9;
                newErr.title = '查询条码失败';
                newErr.message = '未找到对应的条码！';
                res.json({
                    Data: null,
                    Error: newErr
                });
            } else {
                res.json({
                    Data: result,
                    Error: null
                });
            }
        }
    });
};